import {defineStore} from "pinia";
import http from "../utils/http"
export  const useEdits = defineStore("edits",{
    state:()=>{
        return{
            editsList:JSON.parse(localStorage.getItem("xtedit")||"[]"),
        }
    },
    actions:{
        // /api/setting/get
        //获取系统信息
        async geteditList(){
            let res = await http.post("/api/setting/get");
            if(res.status==200){
                // console.log(res,"res")
                this.editsList=res.data.data
                localStorage.setItem("xtedit",JSON.stringify(res.data.data))
            }
        },
        //更改系统设置
        async editxtshezhi(obj){
            let res = await http.post("api/setting",obj);
            if(res.status==201){
                this.editsList=res.data.data
                localStorage.setItem("xtedit",JSON.stringify(res.data.data))
            }
        }
    },
    getters:{

    }
})